export default {
  v_name: 'backgroundImg',
  v_fun: {
    inserted(el, binding) {
      const color = Math.floor(Math.random() * 1000000);
      // eslint-disable-next-line
      el.style.backgroundColor = `#${color}`;
      const img = new Image();
      img.src = binding.value;
      img.onload = () => {
        // eslint-disable-next-line
        el.style.backgroundImage = `url(${binding.value})`;
      };
    },
  },
};
